PHP + PHP-FPM
2017/06/27 |
Install PHP-FPM (FPM : FastCGI Process Manager) to make PHP scripts be fast.
|
|
[1] | |
[2] | Install PHP-FPM. |
root@www:~# apt -y install php-fpm
|
[3] | Configure Apache httpd. |
root@www:~#
vi /etc/php/7.0/fpm/pool.d/www.conf # line 36: change listen = 127.0.0.1:9000
root@www:~#
vi /etc/apache2/sites-enabled/000-default.conf # add into <VirtualHost> - </VirtualHost>
<FilesMatch "\.php$">
SetHandler "proxy:fcgi://127.0.0.1:9000/"
</FilesMatch>
</VirtualHost>
a2enconf php7.0-fpm
root@www:~# a2enmod proxy_fcgi Considering dependency proxy for proxy_fcgi: Enabling module proxy. Enabling module proxy_fcgi. To activate the new configuration, you need to run: service apache2 restartroot@www:~# systemctl restart php7.0-fpm apache2
|
[4] | Create phpinfo and access to it, then it's OK if [FPM/FastCGI] is displayed. |
root@www:~# echo '<?php phpinfo(); ?>' > /var/www/html/info.php |